package chan.project.model.vo;

import cn.hutool.json.JSONUtil;
import chan.project.model.entity.Location;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 地点视图
 *
 * @author <a href="https://github.com/kavansp">kavansp</a>
 * 
 */
@Data
public class LocationVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 名称
     */
    private String name;

    /**
     * 经纬度（格式：经度,纬度）
     */
    private String coordinates;

    /**
     * 地点描述
     */
    private String description;

    /**
     * 地点热度分数
     */
    private Double score;

    /**
     * 封装类转对象
     *
     * @param locationVO
     * @return
     */
    public static Location voToObj(LocationVO locationVO) {
        if (locationVO == null) {
            return null;
        }
        Location location = new Location();
        BeanUtils.copyProperties(locationVO, location);
        return location;
    }

    /**
     * 对象转封装类
     *
     * @param location
     * @return
     */
    public static LocationVO objToVo(Location location) {
        if (location == null) {
            return null;
        }
        LocationVO locationVO = new LocationVO();
        BeanUtils.copyProperties(location,locationVO);
        return locationVO;
    }
}
